import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] str = in.next().toCharArray();
        Stack<Character> stack = new Stack<>();
        //入栈并消除
        for(char x:str) {
            if(!stack.isEmpty()&&stack.peek()==x) stack.pop();
            else stack.add(x);
        }
        String ret="";
        while(!stack.isEmpty()) {
            ret += stack.pop();
        }
        if(ret.length()==0) System.out.print(0);
        else System.out.print(new StringBuilder(ret).reverse().toString());

    }
}
